#!/bin/sh

# Part of Zombie Navigator
# Copyright © 2015  Zombie Navigator Developers

mylog () {
	echo "[`date`] $@" >&2
}

dir="`dirname "$0"`"
dir="`cd "$dir";pwd`"
cd "$dir"

. ./version_info

archivesDir="archives"
targetDir="$archivesDir/${addon_id}_`date +%s`"

mkdir -p "$targetDir"

path="${targetDir}/${addon_id}-${addon_version}.tar.gz"
./archive.sh "$@" > "$path"

if which advdef >/dev/null 2>&1 ; then
	# AdvanceCOMP available
	mylog "Recompressing..."
	advdef -z -4 -i 200 "$path"
else
	mylog "NOTE: Skipping recompression (AdvanceCOMP needed)..."
fi


# vim: ts=4 noet ai

